package app.qrcode.browser.todoapp

import android.content.Intent
import android.os.Bundle
import androidx.navigation.findNavController
import androidx.navigation.ui.setupActionBarWithNavController
import app.qrcode.browser.todoapp.common.ViewBindingActivity
import app.qrcode.browser.todoapp.databinding.ActivityMainBinding
import app.qrcode.browser.todoapp.notification.NotificationService

class MainActivity : ViewBindingActivity<ActivityMainBinding>() {
    //    override fun onCreate(savedInstanceState: Bundle?) {
//        super.onCreate(savedInstanceState)
//        setContentView(R.layout.activity_main)
//
//    }
    override fun onInit(savedInstanceState: Bundle?) {
        val intent = Intent(this, NotificationService::class.java)
        startService(intent)
    }

    override fun onStart() {
        super.onStart()
        setupActionBarWithNavController(findNavController(R.id.navHostFragment))
    }

    override fun onSupportNavigateUp(): Boolean {
        val controller = findNavController(R.id.navHostFragment)
        return controller.navigateUp() || super.onSupportNavigateUp()
    }

    override fun onDestroy() {
        super.onDestroy()
//        val intent = Intent(this, NotificationService::class.java)
//        stopService(intent)
    }




}